
local LoadingBar = class('mLoadingBar',function()
	return display.newNode()
end)



function LoadingBar:ctor(argc)
	print('... create LoadingBar ...')
	self.length = 128
	self.parent = 100
	self.circle = display.newSolidCircle(10, {x=0,y=0,color = cc.c4f(0.5, 1, 1, 1)}):addTo(self)
	self.rect =  display.newRect(cc.rect(-5,0,10,self.length), {fillColor=cc.c4f(0.6,0.2,0.7,1.0),borderColor=cc.c4f(1.0,1.0,0.0,1.0),borderWidth=1}):addTo(self)
	self.backgroundRect =  display.newRect(cc.rect(0,0,20,self.length+14), {fillColor=cc.c4f(0.6,0.8,0.8,0.5)}):addTo(self)
	self.backgroundRect:pos(-10,-3)
	--self.rect:setAnchorPoint(cc.p(0,0))
	self.rect:pos(-5,0)
	self.circle:setLocalZOrder(2)
end

function LoadingBar:setParent(parent)
	local y = self.length*parent/100
	self.circle:pos(0,y)
	self.rect:removeSelf()
	self.rect = display.newRect(cc.rect(-5,0,10,y), {fillColor=cc.c4f(0.6,0.2,0.7,1.0),borderColor=cc.c4f(1.0,1.0,0.0,1.0),borderWidth=1}):addTo(self)
end




return LoadingBar
